<div class="paylog">

<h3><{"New Entry"|msg}></h3>

<{include file="db:`$paylog.dirname`.tab_menu.tpl"}>

<{if count($paylog.errors) > 0}>
<div class="errors">
<ul>
<{foreach from=$paylog.errors item="error"}>
<li><{$error}></li>
<{/foreach}>
</ul>
</div>
<{/if}>

<form action="#" method="post" class="paylog_form">
<table class="outer entry">

<tr>
<th><{"ID"|msg}></th>
<th><{"Date"|msg}></th>
<th><{"Item"|msg}></th>
<th><{"Price"|msg}></th>
<th><{"Flow"|msg}></th>
<{foreach from=$paylog.groups item="group"}>
<th><{$group.name}></th>
<{/foreach}>
</tr>

<{foreach from=$paylog.items item="item" key="increment"}>
<{counter start="-1" print=false}>
<tr class="<{cycle values="odd,even"}>">
<td class="id"><{$increment}></td>
<td class="input date"><input type="text" name="items[<{$increment}>][date]" value="<{$item.date}>" id="box_<{counter}>_<{$increment}>" /></td>
<td class="input"><input type="text" name="items[<{$increment}>][name]" value="<{$item.name}>" id="box_<{counter}>_<{$increment}>" /></td>
<td class="input"><input type="text" name="items[<{$increment}>][price]" value="<{$item.price}>" id="box_<{counter}>_<{$increment}>" /></td>
<td>
<select name="items[<{$increment}>][flow]" id="box_<{counter}>_<{$increment}>">
<option value="1"<{if $item.flow == 1}> selected="selected"<{/if}>><{"Outgo"|msg}></option>
<option value="2"<{if $item.flow == 2}> selected="selected"<{/if}>><{"Income"|msg}></option>
</select>
</td>
<{foreach from=$paylog.groups item="group"}>
<td>
<select name="items[<{$increment}>][tags][<{$group.id}>]" id="box_<{counter}>_<{$increment}>">
<{foreach from=$group.options item="option"}>
<option value="<{$option.id}>"<{if $item.tags[$group.id] == $option.id}> selected="selected"<{/if}>><{$option.name}></option>
<{/foreach}>
</select>
</td>
<{/foreach}>
</tr>
<{/foreach}>

</table>

<div class="center">
<input type="submit" name="save" value="<{"Save"|msg}>" class="button icon ok" />
</div>

<input type="hidden" name="token" value="<{$paylog.token}>" />

</form>

</div>